using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Simnova.Collaborate.Presenter;
using Simnova.Collaborate.View;

public partial class FeedbackRating : System.Web.UI.Page, IFeedbackRating
{
    FeedbackRatingPresenter _feedbackRatingPresenter;

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        this._feedbackRatingPresenter = new FeedbackRatingPresenter(this, int.Parse(Request.QueryString["FeedbackId"].ToString()), int.Parse(Session["UserId"].ToString()));
    }

    protected void Page_Load(object sender, EventArgs e)
    {
    }

    #region IFeedbackRating Members

    string IFeedbackRating.Title
    {
        set { TitleLinkButton.Text = value; }
    }

    string IFeedbackRating.Description
    {
        set { DescriptionLabel.Text = value; }
    }

    short IFeedbackRating.Rating
    {
        get
        {
            return short.Parse(RatingRadioButtonList.SelectedValue);
        }
        set
        {
            RatingRadioButtonList.SelectedValue = value.ToString();
        }
    }

    string IFeedbackRating.Comment
    {
        get
        {
            return CommentTextBox.Text;
        }
        set
        {
            CommentTextBox.Text = value;
        }
    }

    IList IFeedbackRating.Ratings
    {
        set 
        { 
            RatingsDataList.DataSource = value;
            RatingsDataList.DataBind();
        }
    }

    #endregion

    protected void TitleLinkButton_Click(object sender, EventArgs e)
    {
        Response.Redirect(@"FeedbackSummary.aspx?FeedbackId=" + Request.QueryString["FeedbackId"]);
    }

    protected void SaveRatingButton_Click(object sender, EventArgs e)
    {
        this._feedbackRatingPresenter.Save();
    }
}
